package rpg.engine.model;

import rpg.client.model.Position;
import rpg.util.Objects;
import rpg.util.Strings;

public class Mover {
	public static class Builder {
		public Builder()  {
			super();
		}

		private String id = "";
		public Builder id(String s)  {
			id = s;
			return this;
		}
		
		private String description = "";
		public Builder description(String s)  {
			description = s;
			return this;
		}
		
		private Position from = Position.VOID;
		public Builder from(Position p)  {
			from = p;
			return this;
		}
		
		private Position to = Position.VOID;
		public Builder to(Position p)  {
			to = p;
			return this;
		}

		private boolean active = true;
		public Builder active(boolean b)  {
			active = b;
			return this;
		}
		
		public Mover build()  {
			return new Mover(this);
		}
	}

	private final boolean active;
	public boolean isActive()  {
		return active;
	}
	
	private final String id;
	public String getId()  {
		return id;
	}
	
	private final String description;
	public String getDescription()  {
		return description;
	}

	private final Position from;
	public Position getFrom()  {
		return from;
	}
	
	private final Position to;
	public Position getTo() {
		return to;
	}
	
	private Mover(Builder b)  {
		super();
		id = Strings.requireNonEmpty(b.id, "Mover.id");
		description = Strings.requireNonEmpty(b.description, "Mover.description");
		from = Objects.requireNonNull(b.from, "Mover.from");
		to = Objects.requireNonNull(b.to, "Mover.to");
		active = b.active;
	}
}
